package com.abbas.smartCity.ui;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.abbas.smartCity.base.BaseActivity;
import com.abbas.smartCity.bean.HomeBannerBean;
import com.abbas.smartCity.bean.ServerBean;
import com.abbas.smartCity.okhttp.IOkGoCallback;
import com.abbas.smartCity.okhttp.OkGo;
import com.abbas.smartCity.okhttp.OkGoCallback;
import com.abbas.smartCity.retroft.ICallback;

import java.util.List;

import okhttp3.Call;
import retrofit2.Retrofit;

@Deprecated
public class TestActivity extends BaseActivity {

    @Override
    protected int getLayoutId() {
        return 0;
    }

    @Override
    protected String setCustomTitle() {
        return null;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        //java 获取全部服务
        OkGo.get("/prod-api/api/service/list", ServerBean.class, new OkGoCallback<ServerBean>() {
            @Override
            public void onSuccess(Call call, ServerBean data) {
                //此括号内为成功，若还需选择性重写访问失败，请看下一个例子
                final List<ServerBean.RowsBean> rows = data.getRows();

            }

            @Override
            public void onFailure(String msg) {

            }
        });

        OkGo.get("/prod-api/api/service/list", ServerBean.class, new IOkGoCallback<ServerBean>() {
            @Override
            public void onSuccess(Call call, ServerBean data) {
                //此括号内为成功
                final List<ServerBean.RowsBean> rows = data.getRows();

            }

            @Override//此失败方法可有可无
            public void onFailure(String msg) {
                super.onFailure(msg);
            }
        });

        api.getHomeBanner().enqueue(new ICallback<HomeBannerBean>() {
            @Override
            public void onSuccess(retrofit2.Call<HomeBannerBean> call, HomeBannerBean data) {

            }
        });

    }

    @Override
    protected void initEvent() {

    }

}
